home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1998 #4 / Amiga Plus CD - 1998 - No. 4.iso / pd / programmierung / efmuilib / examples / eflistmulti.asc < prev    next >
Text File  |  1998-02-03  |  5KB  |  152 lines

  1. ;******************************************
  2. ;* EFListMulti.asc                        *
  3. ;* ~~~~~~~~~~~~~~~                        *
  4. ;* Shows how to use a multi-columns list. *
  5. ;******************************************
  6. ;
  7. ;(C)opyRight 1998 by Vivid Imagination
  8.  
  9.  
  10. NEWTYPE.en              ;This NEWTYPE is used
  11.   *entrie.b[3]          ;to get the entries
  12. End NEWTYPE             ;
  13.  
  14. DEFTYPE.en *buf
  15. DEFTYPE.l
  16.  
  17. Dim *en.b(40)        ;*en() contains the pointers to ALL entries
  18. Dim *entr.b(15)      ;*entr() contains the pointers for each line
  19.  
  20. Dim *en2.b(40)       ;This the second
  21. Dim *entr2.b(15)     ;arrays of entries
  22.  
  23.  
  24. n=0
  25. For i=0 To 30 Step 3                                          ;We create pointers
  26.   For j=0 To 2                                                ;to our entries
  27.     *en(i+j)=Null("Coords : ("+Str$(j+1)+","+Str$(n+1)+")")   ;There is no other
  28.     *en2(i+j)=Null("A second list! ("+Str$(j+1)+","+Str$(n+1)+")")
  29.   Next                                                        ;proper way of doing
  30.   *entr(n)=&*en(i)                                            ;multi-columns
  31.   *entr2(n)=&*en2(i)
  32.   n+1
  33. Next
  34.  
  35. MUIApplicationTitle       "EFListMulti"
  36. MUIApplicationVersion     "$VER: EFListMulti 1.0 (02.03.98)"
  37. MUIApplicationCopyright   "(c)1998, Vivid Imagination"
  38. MUIApplicationAuthor      "Erwan Fouret"
  39. MUIApplicationDescription "An example of Multi-columns list."
  40. MUIApplicationBase        "EFLISTMULTI"
  41.  
  42. MUIListHook On
  43. MUIAddTags 1,#MUIA_Frame,#MUIV_Frame_InputList
  44. MUIAddTags 1,#MUIA_List_ShowDropMarks,1                                ;This lines must be
  45. MUIAddTags 1,#MUIA_List_DragSortable,1                                 ;removed if you don't
  46. MUIAddTags 2,#MUIA_Listview_DragType,#MUIV_Listview_DragType_Immediate ;want Drag'n'Drop
  47. MUIList 1,"BAR,BAR,",*entr()
  48.  
  49. MUIListView 2,1
  50.  
  51. MUIAddTags 3,#MUIA_String_AttachedList,MUIObjLoc(2)   ;<- This tag allows you
  52. MUIString 3,"",100                                    ;to use cursor keys to
  53.                                                       ;browse the list when a
  54. MUIAddTags 4,#MUIA_String_AttachedList,MUIObjLoc(2)   ;String gadget is selected
  55. MUIString 4,"",100
  56.  
  57. MUIAddTags 5,#MUIA_String_AttachedList,MUIObjLoc(2)
  58. MUIString 5,"",100
  59.  
  60. MUISimpleButton 6,"_Clear"
  61. MUISimpleButton 7,"_Change"
  62. MUISimpleButton 8,"_Quit"
  63.  
  64. MUIAddObjsHGroup 0,3,4,5
  65. MUICreateHGroup 0
  66.  
  67. MUIAddObjsHGroup 9,6,7,8
  68. MUICreateHGroup 9
  69.  
  70. MUIAddObjsVGroup 10,2,0,9
  71. MUICreateVGroup 10
  72.  
  73. MUICreateWindow 11,"EFListMulti","EFLM",10
  74. MUIAddSubWindow 11
  75. If MUICreateApplication<>True Then End
  76.  
  77. MUINotifyApp 1,#MUIA_List_Active,#MUIV_EveryTime,1
  78. MUINotifyApp 3,#MUIA_String_Contents,#MUIV_EveryTime,3
  79. MUINotifyApp 4,#MUIA_String_Contents,#MUIV_EveryTime,4
  80. MUINotifyApp 5,#MUIA_String_Contents,#MUIV_EveryTime,5
  81. MUINotifyApp 6,#MUIA_Pressed,0,6
  82. MUINotifyApp 7,#MUIA_Pressed,0,7
  83. MUINotifyApp 8,#MUIA_Pressed,0,-1
  84. MUINotifyApp 11,#MUIA_Window_CloseRequest,1,-1
  85.  
  86. MUIOpenWindow 11
  87.  
  88. ls=1  ;the acual list set is *en (=>1)
  89.  
  90. Repeat
  91.   ev.l=MUIWaitEvent
  92.   Select ev
  93.   Case 1
  94.     MUIDoMethod 1,#MUIM_List_GetEntry,#MUIV_List_GetEntry_Active,&*buf
  95.     MUISet 3,#MUIA_String_Contents,*buf\entrie[0]
  96.     MUISet 4,#MUIA_String_Contents,*buf\entrie[1]
  97.     MUISet 5,#MUIA_String_Contents,*buf\entrie[2]
  98.   Case 3
  99.     If ls>0
  100.       act=MUIGet(1,#MUIA_List_Active)
  101.       *str=MUIGet(3,#MUIA_String_Contents)
  102.       If ls=1
  103.         *en((act)*3)=Null(Peek$(*str))
  104.       Else
  105.         *en2((act)*3)=Null(Peek$(*str))
  106.       EndIf
  107.       MUIRedrawSingle 2,act
  108.     EndIf
  109.   Case 4
  110.     If ls>0
  111.       act=MUIGet(1,#MUIA_List_Active)
  112.       *str=MUIGet(4,#MUIA_String_Contents)
  113.       If ls=1
  114.         *en((act)*3+1)=Null(Peek$(*str))
  115.       Else
  116.         *en2((act)*3+1)=Null(Peek$(*str))
  117.       EndIf
  118.       MUIRedrawSingle 2,act
  119.     EndIf
  120.   Case 5
  121.     If ls>0
  122.       act=MUIGet(1,#MUIA_List_Active)
  123.       *str=MUIGet(5,#MUIA_String_Contents)
  124.       If ls=1
  125.         *en((act)*3+2)=Null(Peek$(*str))
  126.       Else
  127.         *en2((act)*3+2)=Null(Peek$(*str))
  128.       EndIf
  129.       MUIRedrawSingle 2,act
  130.     EndIf
  131.   Case 6
  132.     MUIChangeList 1                                     ;Clear the list
  133.     ls=-1
  134.     MUISet 3,#MUIA_String_Contents,Null(" ")
  135.     MUISet 4,#MUIA_String_Contents,Null(" ")
  136.     MUISet 5,#MUIA_String_Contents,Null(" ")
  137.   Case 7
  138.     MUIChangeList 1,*entr2(),#MUIV_List_Insert_Bottom   ;Replace the old list
  139.     ls=2
  140.     MUIDoMethod 1,#MUIM_List_GetEntry,#MUIV_List_GetEntry_Active,&*buf
  141.     MUISet 3,#MUIA_String_Contents,*buf\entrie[0]
  142.     MUISet 4,#MUIA_String_Contents,*buf\entrie[1]
  143.     MUISet 5,#MUIA_String_Contents,*buf\entrie[2]
  144.     MUISet 1,#MUIA_List_Active,#MUIV_List_Active_Top
  145.   End Select
  146. Until ev=-1
  147.  
  148. MUICloseWindow 11
  149.  
  150. End
  151.  
  152.